﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>大众进口汽车高尔夫-预约试驾</title>
<style type="text/css">
body{margin:0;font-family: Arial;background:#97a29c; }
.warpper{ background:url(images/bg.jpg) no-repeat top center;margin:0 auto;width:537px;height:365px; padding:100px 0 0 170px;}
.main{position:relative;}

.p01{position:absolute;width:20px;height:20px;left: 75px;top: 37px;}
.p02{position:absolute;width:20px;height:20px;left: 130px;top: 37px;}
.p03{position:absolute;width:150px;height:20px;left: 75px;top: 63px;}
.p04{position:absolute;width:20px;height:20px;left: 235px;top: 63px;}
.p05{position:absolute;width:20px;height:20px;left: 330px;top: 63px;}
.p06{position:absolute;width:150px;height:20px;left: 75px;top: 85px;}
.p07{position:absolute;width:150px;height:20px;left: 75px;top: 108px;}
.p08{position:absolute;width:20px;height:20px;left: 235px;top: 133px;}
.p09{position:absolute;width:20px;height:20px;left: 330px;top: 133px;}
.p10{position:absolute;width:60px;height:20px;left: 235px;top: 163px;}


.iform{background:none;border:0;border-bottom:1px solid #828583; width:120px; color:#828583; font-size:12px;}
</style>
<script src="cds/vwgolf/js/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="js/flag.js" type="text/javascript"></script>
<script src="urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
  _userv=0;
</script>

            <script type="text/javascript">
                $(function() {
                    function getBytesCount(str) {
                        var bytesCount = 0;
                        if (str != null) {
                            for (var i = 0; i < str.length; i++) {
                                var c = str.charAt(i);
                                if (/^[\u0000-\u00ff]$/.test(c)) {
                                    bytesCount += 1;
                                }
                                else {
                                    bytesCount += 2;
                                }
                            }
                        }
                        return bytesCount;
                    }
                    var error;
                    function checkEmail() {
                        var email = $.trim($('[id$=email]').val());
                        if (email == '') {
                            error += '请填写邮箱地址。\n';
                        }
                        else {
                            var reg = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
                            if (!reg.test(email)) {
                                error += '邮箱地址格式错误。\n';
                            }
                            else {
                                $.ajax({
                                    url: 'cds/vwgolf/operation/ajaxHandler.aspx',
                                    data: 'op=checkEmail&email=' + email,
                                    dataType: 'text',
                                    type: 'post',
                                    async: false,
                                    success: function(result) {
                                        if (parseInt(result) > 0) {
                                            error += 'email已存在。\n';
                                        }
                                    }
                                });
                            }
                        }
                    }
                    checkMobile = function() {
                        var mobile = $.trim($('[id$=mobile]').val());
                        if (mobile != '') {
                            if (!/\d{11}/.test(mobile)) {
                                error += '手机应为11位数字。\n';
                                $('#mobile').val('');
                            }
                        }
                    }

                    function checkSubmit() {
                        if ($('[name$=sex]:checked').size() == 0) {
                            error += '请选择称谓。\n';
                        }
                        var userName = $.trim($('[id$=userName]').val());
                        if (userName == '') {
                            error += '请填写姓名。\n';
                        }
                        else if (getBytesCount(userName) > 12) {
                            error += '姓名不能超过12个字符！\n';
                        }
                        if ($.trim($('#mobile').val()) == '') {
                            error += '请填写手机号。\n';
                        }
                        else {
                            checkMobile();
                        }
                        checkEmail();
                        if ($('[name$=testDriveModels]:checked').size() == 0) {
                            error += '请选择试驾车型。\n';
                        }
                    }
                    checkRegister = function() {
                        urchinTracker('/track2/TestDrive/Submit');
                        error = '';
                        checkSubmit();
                        var href = window.location.href;
                        if (error != '') {
                            alert(error);
                        }
                        else {
                            urchinTracker('/track2/TestDrive/Success');
                            $('#form1').submit();
                            $('#pop').css({height:$(document).height(),opacity:0.7}).show();
                            alert('您的信息正在提交');
                        }
                    }

                    clearForm = function() {
                        $('select').val('0');
                        $('input[type=radio]').attr('checked', false);
                        $('input[type=text]').val('');
                    }
                });

            </script>
</head>

<body>
<div id="pop" style="background-color:Gray; position:absolute;width:100%; z-index:9999; display:none;"></div>
<div class="warpper">
	<div class="main">
	<form id="form1" action="cds/vwgolf/operation/action.aspx" method="post">
            <input id="Hidden1" type="hidden" name="op" value="register" />
		<div class="p01"><input type="radio" name="sex" value="M"/></div>
		<div class="p02"><input type="radio" name="sex" value="F"/></div>
		<div class="p03"><input type="text" name="userName" id="userName" class="iform" /></div>
		<div class="p04"><input type="radio" name="testDriveModels" value="CrossGolf" /></div>
		<div class="p05"><input type="radio" name="testDriveModels" value="Golf旅行轿车"/></div>
		<div class="p06"><input type="text" name="mobile" id="mobile" maxlength="11" class="iform" /></div>
		<div class="p07"><input type="text" name="email" id="email" class="iform" /></div>
		<div class="p08"><input type="radio" name="receiveInfo" value="是" checked="checked" /></div>
		<div class="p09"><input type="radio" name="receiveInfo" value="否" /></div>
		<div class="p10"><input id="submit1" type="button" value="" onclick="checkRegister()" style="background:url(images/btn.gif);width:64px;height:21px;border:none;cursor:pointer;" /></div>
	</form>
	</div>
</div>
</body>
</html>
